# 安装request库
# 安装命令：pip install requests

import requests

# url1 = "https://www.baidu.com/s?"
# url2 = "https://www.douban.com"
header = {
    "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36 Edg/127.0.0.0"
}
# req = requests.get(url2, headers=header)
# print(req)
#
# # 构建字典
# kw = {
#     "wd": "赵文卓"
# }
# req2 = requests.get(url1, headers=header, params=kw)
# req2.encoding="utf-8"
# print(req2.text)


url1 = "https://www.httpbin.org/post"
kw = {
    "wd": "赵文卓"
}
req3 = requests.post(url1, data=kw)
req3.encoding = "utf-8"
print(req3.text)

# 登录地址
url4 = "https://wordpress-edu-3autumn.localprod.oc.forchange.cn/wp-login.php"
# https://wordpress-edu-3autumn.localprod.oc.forchange.cn/wp-login.php?action=rp&key=acaRHF0h7SUv8Wtj19Cs&login=zwz%3E
data = {
    # 登录信息
    "og": "491008420@qq.com",
    "pwd": "p1pjzC4op4ahgJDfUm4Z",
    "wp-submit": "登录",
    "redirect_to": "https://wordpress-edu-3autumn.localprod.oc.forchange.cn",
    "testcookie": "1"
}
data2 = {
    # 注册信息
    "user_login": "zwz",
    "user_email": "491008420@qq.com",
    "redirect_to": "",
    "wp-submit": "注册"
}
header = {
    "accept-encoding": "gzip, deflate, br, zstd",
    "accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
    "cache-control": "max-age=0",
    "connection": "keep-alive",
    "content-length": "149",
    "content-type": "application/x-www-form-urlencoded"
}
req4 = requests.post(url4, data=data, headers=header)
print(req4.text)
